
<div class="form-group">
    <label class="col-sm-2 control-label must">商户名称</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <input type="text" class="form-control" name="merchname" value="{$item['merchname']}" />
        {else}
        <div class="form-control-static">{$item['merchname']}</div>
        {/if}
    </div>
</div>

{if !empty($member)}
<div class="form-group">
    <label class="col-sm-2 control-label">昵称</label>
    <div class="col-sm-8">
        <div class="form-control-static"><a target="_blank" href="{php echo webUrl('member/list/detail',array('id'=>$member['id']))}"> {$member['nickname']}</a></div>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">openid</label>
    <div class="col-sm-8">
        <div class="form-control-static">{$item['openid']}</div>
    </div>
</div>
{/if}

<div class="form-group">
    <label class="col-sm-2 control-label">商户logo</label>
    <div class="col-sm-9 col-xs-12">
        {ifp 'merch.user.edit'}
        {php echo tpl_form_field_image('logo',$item['logo'],'../addons/ewei_shopv2/static/images/nopic.jpg')}
        <span class="help-block">商户logo 建议尺寸 300 * 300</span>
        {else}
        {if empty($item['logo'])}
        <img src="../addons/ewei_shopv2/static/images/nopic.jpg" onerror="this.src='../addons/ewei_shopv2/static/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
        {else}
        <img src="{php echo tomedia($item['logo'])}" onerror="this.src='../addons/ewei_shopv2/static/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
        {/if}
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">主营项目</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <input type="text" class="form-control" name="salecate" value="{$item['salecate']}" />
        {else}
        <div class="form-control-static">{$item['merchname']}</div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">商户分类</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <select class="form-control" name="cateid" required>
            {loop $category $c}
            <option value="{$c['id']}" {if $item['cateid']==$c['id']}selected{/if}>{$c['catename']}</option>
            {/loop}
        </select>

        {else}
        <div class="form-control-static">
            {loop $category $c}
            {if $item['cateid']==$c['id']}{$c['catename']}{/if}
            {/loop}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">联系人</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <input type="text" class="form-control" name="realname" value="{$item['realname']}" />
        {else}
        <div class="form-control-static">{$item['realname']}</div>
        {/if}
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label must">联系电话</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <input type="tel" class="form-control" name="mobile" value="{$item['mobile']}" />
        {else}
        <div class="form-control-static">{$item['mobile']}</div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">商户简介</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <textarea name="desc1" class="form-control">{$item['desc']}</textarea>
        {else}
        <div class="form-control-static">{$item['desc']}</div>
        {/if}
    </div>
</div>

<div class="form-group" style="display: none">
    <label class="col-sm-2 control-label">商户地址</label>
    <div class="col-sm-9 col-xs-12">
        {ife 'merch.user' $item}
        <input type="text" name="address2" class="form-control" value="{$item['address2']}" />
        {else}
        <div class='form-control-static'>{$item['address']}</div>
        {/if}
    </div>
</div>

<div class="form-group" style="display: none">
    <label class="col-sm-2 control-label">商户电话</label>
    <div class="col-sm-9 col-xs-12">
        {ife 'merch.user' $item}
        <input type="text" name="tel" class="form-control" value="{$item['tel']}" />
        {else}
        <div class='form-control-static'>{$item['tel']}</div>
        {/if}
    </div>
</div>

<div class="form-group" style="display: none">
    <label class="col-sm-2 control-label">商户位置</label>
    <div class="col-sm-9 col-xs-12">
        {ife 'merch.user' $item}
        {php echo tpl_form_field_coordinate('map',array('lng'=>$item['lng'],'lat'=>$item['lat']))}
        {else}
        <div class='form-control-static'>lng={$item['lng']},lat={$item['lat']}</div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">是否推荐</label>
    <div class="col-sm-9 col-xs-12">
        {ife 'merch.user' $item}
        <label class="radio-inline">
            <input type="radio" name='isrecommand' value="1" {if $item['isrecommand']==1}checked{/if} /> 是
        </label>
        <label class="radio-inline">
            <input type="radio" name='isrecommand' value="0" {if empty($item['isrecommand'])}checked{/if} /> 否
        </label>
        {else}
        <div class='form-control-static'>{if empty($item['isrecommand'])}否{else}是{/if}</div>
        {/if}
    </div>
</div>

{if $diyform_flag}
<div class="form-group-title">追加资料</div>
{template 'diyform/diyform_input'}
{else}
{/if}

<div class="form-group-title">帐号信息</div>

<div class="form-group">
    <label class="col-sm-2 control-label">主账户名</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <input type="text" class="form-control" name="username" value="{$account['username']}" />
        {else}
        <div class="form-control-static">{$item['username']}</div>
        {/if}
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label">主账户密码</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <input type="text" class="form-control" name="pwd" />
        {else}
        <div class="form-control-static">******</div>
        {/if}
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label">子账户数量</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <input type="num" class="form-control" name="accounttotal" value="{$item['accounttotal']}"/>
        <span class="help-block">商户可以创建的子管理帐号个数，默认不能创建</span>
        {else}
        <div class="form-control-static">{$item['accounttotal']} 个子账户</div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">服务到期时间</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        {php echo tpl_form_field_date('accounttime',$accounttime)}
        <span class="help-block">商户账户有效期限</span>
        {else}
        <div class="form-control-static">{php echo date('Y-m-d',$accounttime)} 到期</div>
        {/if}
    </div>
</div>

<div class="form-group-title">商户权限组</div>
<div class="form-group">
    <label class="col-sm-2 control-label must">商户组</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <select class="form-control" name="groupid" required>
            {loop $groups $g}
            <option value="{$g['id']}" {if $item['groupid']==$g['id']}selected{/if}>{$g['groupname']}</option>
            {/loop}
        </select>

        {else}
        <div class="form-control-static">
            {loop $groups $g}
               {if $item['groupid']==$g['id']}{$g['groupname']}{/if}
            {/loop}
        </div>
        {/if}
    </div>
</div>

<div class="form-group-title">商户备注</div>
<div class="form-group">
    <label class="col-sm-2 control-label">商户备注</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <textarea name="remark" class="form-control">{$item['remark']}</textarea>
        {else}
        <div class="form-control-static">{$item['remark']}</div>
        {/if}
    </div>
</div>
<div class="form-group-title">入驻状态</div>
<div class="form-group">
    <label class="col-sm-2 control-label">状态</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        {if !empty($item) && $item['status']<=0}
        <label class="radio-inline">
            <input type="radio" name="status" value="0" {if $item['status']==0}checked{/if} /> 待入驻
        </label>
        {/if}

        <label class="radio-inline">
            <input type="radio" name="status" value="1" {if $item['status']==1}checked{/if} />允许入驻
        </label>
        <label class="radio-inline">
            <input type="radio" name="status" value="2" {if $item['status']==2}checked{/if}/> 暂停中
        </label>
        {else}
        <div class="form-control-static">
            {if $item['status']==0}
            待入驻
            {elseif $item['stauts']==1}
            允许入驻
            {elseif $item['stauts']==2}
            暂停中
            {/if}
        </div>
        {/if}
    </div>
</div>

<div class="form-group-title">商户结算</div>
<div class="form-group">
    <label class="col-sm-2 control-label">抽成利率</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        <div class="input-group">
            <input type="text" class="form-control" name="payrate" value="{$item['payrate']}" /><span class="input-group-addon">%</span>
        </div>
        {else}
        <div class="form-control-static">{$item['payrate']}</div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">收款人</label>
    <div class="col-sm-8">
        {ife 'merch.user' $item}
        {php echo tpl_selector('payopenid',array('required'=>false,'preview'=>false,'key'=>'openid','text'=>'nickname','type'=>'text','placeholder'=>'昵称/姓名/手机号','buttontext'=>'选择收款人 ', 'items'=>$user,'url'=>webUrl('member/query') ))}
        {else}
        <div class="form-control-static">{$item['payopenid']}</div>
        {/if}
    </div>
</div>
